// components/orderunsigned/orderunsigned.js

import {reqOrderAgain} from '../../api/order'
import {setStorage,removeStorage} from '../../utils/storage'
Component({

  /**
   * 组件的属性列表
   */
  properties: {
    url:{
      type:String,
      value:''
    },
    name:{
      type:String,
      value:''
    },
    specification:{
      type:String,
      value:''
    },
    datetime:{
      type:String,
      value:''
    },
    price:{
      type:String,
      value:''
    },
    count:{
      type:String,
      value:''
    },
    status:{
      type:String,
      value:''
    },
    orderId:{
      type:String,
      value:''
    }
  },

  /**
   * 组件的初始数据
   */
  data: {

  },

  /**
   * 组件的方法列表
   */
  methods: {
    navigateToOrderDetail(){
      const orderId = this.properties.orderId
      wx.navigateTo({
        url: `/pages/orderdetail/orderdetail?orderId=${orderId}`,
      })
    },

    async orderAgain(){
      const orderId = this.properties.orderId
      const {data} = await reqOrderAgain(orderId)
      removeStorage('ordersubmitgoods')
      setStorage('ordersubmitgoods',data)
      wx.navigateTo({
        url: '/pages/ordersubmit/ordersubmit',
      })
    }
  }
})